﻿using System;
using System.Xml.Serialization;

namespace UmdhTracer
{
    [XmlRoot("BackTraceMeasurement")]
    public class BackTraceMeasurement
    {
        public DateTime MeasurementTime { get; set; }
        public int BytesDelta { get; set; }
        public int BytesNew { get; set; }
        public int BytesOld { get; set; }

        public int AllocDelta { get; set; }
        public int AllocNew { get; set; }
        public int AllocOld { get; set; }
    }

    [XmlRoot("BackTraces")]
    public class BackTraces
    {
        public string Id { get; set; }
        public string Description { get; set; }
        public SerializableDictionary<DateTime, BackTraceMeasurement> Measurements = new SerializableDictionary<DateTime, BackTraceMeasurement>();

        public BackTraces()
        {
        }

        public BackTraces(string id, string description)
        {
            Id = id;
            Description = description;
            Measurements = new SerializableDictionary<DateTime, BackTraceMeasurement>();
        }

        public void AddMeasure(DateTime measurementTime, BackTraceMeasurement backtrace)
        {
            Measurements.Add(measurementTime, backtrace);
        }
    }
}
